package com.buss.group.service.impl;
import com.buss.group.service.BnsGroupArticleScoreServiceI;
import org.jeecgframework.core.common.service.impl.CommonServiceImpl;
import com.buss.group.entity.BnsGroupArticleScoreEntity;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import java.util.UUID;
import java.io.Serializable;

@Service("bnsGroupArticleScoreService")
@Transactional
public class BnsGroupArticleScoreServiceImpl extends CommonServiceImpl implements BnsGroupArticleScoreServiceI {

	
 	public <T> void delete(T entity) {
 		super.delete(entity);
 		//执行删除操作配置的sql增强
		this.doDelSql((BnsGroupArticleScoreEntity)entity);
 	}
 	
 	public <T> Serializable save(T entity) {
 		Serializable t = super.save(entity);
 		//执行新增操作配置的sql增强
 		this.doAddSql((BnsGroupArticleScoreEntity)entity);
 		return t;
 	}
 	
 	public <T> void saveOrUpdate(T entity) {
 		super.saveOrUpdate(entity);
 		//执行更新操作配置的sql增强
 		this.doUpdateSql((BnsGroupArticleScoreEntity)entity);
 	}
 	
 	/**
	 * 默认按钮-sql增强-新增操作
	 * @param id
	 * @return
	 */
 	public boolean doAddSql(BnsGroupArticleScoreEntity t){
	 	return true;
 	}
 	/**
	 * 默认按钮-sql增强-更新操作
	 * @param id
	 * @return
	 */
 	public boolean doUpdateSql(BnsGroupArticleScoreEntity t){
	 	return true;
 	}
 	/**
	 * 默认按钮-sql增强-删除操作
	 * @param id
	 * @return
	 */
 	public boolean doDelSql(BnsGroupArticleScoreEntity t){
	 	return true;
 	}
 	
 	/**
	 * 替换sql中的变量
	 * @param sql
	 * @return
	 */
 	public String replaceVal(String sql,BnsGroupArticleScoreEntity t){
 		sql  = sql.replace("#{id}",String.valueOf(t.getId()));
 		sql  = sql.replace("#{create_name}",String.valueOf(t.getCreateName()));
 		sql  = sql.replace("#{create_by}",String.valueOf(t.getCreateBy()));
 		sql  = sql.replace("#{create_date}",String.valueOf(t.getCreateDate()));
 		sql  = sql.replace("#{update_name}",String.valueOf(t.getUpdateName()));
 		sql  = sql.replace("#{update_by}",String.valueOf(t.getUpdateBy()));
 		sql  = sql.replace("#{update_date}",String.valueOf(t.getUpdateDate()));
 		sql  = sql.replace("#{article_id}",String.valueOf(t.getArticleId()));
 		sql  = sql.replace("#{score_userid}",String.valueOf(t.getScoreUserid()));
 		sql  = sql.replace("#{experience}",String.valueOf(t.getExperience()));
 		sql  = sql.replace("#{prestige}",String.valueOf(t.getPrestige()));
 		sql  = sql.replace("#{charm}",String.valueOf(t.getCharm()));
 		sql  = sql.replace("#{contribution}",String.valueOf(t.getContribution()));
 		sql  = sql.replace("#{jindou}",String.valueOf(t.getJindou()));
 		sql  = sql.replace("#{reason}",String.valueOf(t.getReason()));
 		sql  = sql.replace("#{UUID}",UUID.randomUUID().toString());
 		return sql;
 	}
}